<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="__PUBLIC__/admin/ckeditor/ckeditor.js"></script>
    <script src="__PUBLIC__/js/jquery-1.11.0.min.js"></script>
    <script src="__PUBLIC__/js/jquery.form.js"></script>
    <style>
        body {
            width: 960px;
            margin: 0 auto;
        }
    </style>
    <script>
        $(document).ready(function(){
            $('#btn').click(function(){
                $('#upload_form').ajaxSubmit(function(obj){
                    if (!obj.flag) {
                        alert(obj.message);
                    } else {
                        var tr = document.createElement("tr");
                        var id = document.createElement("td");
                        id.innerText = obj.id;
                        var type = document.createElement("td");
                        type.innerText = obj.type;
                        var path = document.createElement("td");
                        /*
                        * SAE change here
                        * */
                        //path.innerText = obj.path;
                        path.innerText = "__PUBLIC__" + obj.path;
                        tr.appendChild(id);
                        tr.appendChild(type);
                        tr.appendChild(path);
                        $('#tb').append(tr);
                    }
                });
                return false;
            });
        });
    </script>
</head>
<body>
<form action={:U('save')} method="post">
    <p id="edt">
        <label for="editor1">
            Editor 1:
        </label>
        <textarea class="ckeditor" cols="80" id="editor1" name="content" rows="50">
        </textarea>
    </p>
    <p>
        <label for="title">
            标题：
        </label>
        <input type="text" id="title" name="title" />
    </p>
    <p>
        类型：
        <input type="radio" name="type" value=1 onclick="document.getElementById('smy').style.display='';
                                                                document.getElementById('pic').style.display='none';
                                                                document.getElementById('edt').style.display='';" checked/> 首页显示简介
        <input type="radio" name="type" value=2 onclick="document.getElementById('smy').style.display='none';
                                                                document.getElementById('pic').style.display='';
                                                                document.getElementById('edt').style.display='';" /> 首页显示图片
        <input type="radio" name="type" value=3 onclick="document.getElementById('smy').style.display='';
                                                                document.getElementById('pic').style.display='none';
                                                                document.getElementById('edt').style.display='';" /> 专家文章1
        <input type="radio" name="type" value=4 onclick="document.getElementById('smy').style.display='';
                                                                document.getElementById('pic').style.display='';
                                                                document.getElementById('edt').style.display='';" /> 专家文章2
        <input type="radio" name="type" value=5 onclick="document.getElementById('smy').style.display='';
                                                                document.getElementById('pic').style.display='';
                                                                document.getElementById('edt').style.display='none';" /> 专家信息
    </p>
    <p id="smy">
        <label for="summary">
            简介：
        </label>
        <textarea id="summary" name="summary"></textarea>
    </p>
    <p id="pic" style="display: none">
        <label for="pid">
            图片id：
        </label>
        <input type="text" id="pid" name="pid" />
    </p>
    <p>
        <input type="submit" value="Submit">
    </p>
</form>
<p>
    <table border="1" id="tb">
        <tr>
            <th>id</th><th>类型</th><th>路径</th>
        </tr>

    </table>
</p>
<form id="upload_form" action="{:U('Upload/index')}" enctype="multipart/form-data" method="post" >
    <select name="type">
        <option value=1>Picture</option>
        <option value=2>Flv</option>
        <option value=3>Swf</option>
    </select>
    <input type="file" name="file" />
    <input type="submit" id="btn" value="提交" >
</form>
</body>
</html>